#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10, M = N * 31;
int tr[M][2], idx;
int s[M], cnt[M];
int n, m;

void insert(int x, int v)
{
    int p = 0;
    for (int i = 30; i >= 0; i--) {
        int t = x >> i & 1;
        if (!tr[p][t]) tr[p][t] = ++idx;
        p = tr[p][t];
        cnt[p] += v;
    }
}

int query(int x)
{
    int ans = 0;
    int p = 0;
    for (int i = 30; i >= 0; i--) {
        int t = x >> i & 1;
        if (cnt[tr[p][!t]]) {
            p = tr[p][!t];
            ans = ans * 2 + 1;
        }
        else {
            p = tr[p][t];
            ans = ans * 2;
        }
    }
    return ans;
}
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        s[i] = s[i - 1] ^ x;
    }
    insert(s[0], 1);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i - m - 1 >= 0) {
            insert(s[i - m - 1], -1);
        }
        ans = max(ans, query(s[i]));
        insert(s[i], 1);
    }
    cout << ans << endl;
    return 0;
}